package cn.gson.crm.controller.counselor;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.StudentPoDao;
import cn.gson.crm.model.entity.Employee;
import cn.gson.crm.model.po.FollowStudentPo;

@WebServlet("/counselor/allocated")
public class AllocatedStudent extends BaseServlet{
	/**
	 * 获取已分配的学生
	 */
	private static final long serialVersionUID = 1L;
	private StudentPoDao stuPoDao = new StudentPoDao();

	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		Employee emp = (Employee) request.getSession().getAttribute("emplo");
		String p = request.getParameter("page");
		if(p==null||p.isEmpty()){
			p="1";
		}
		Integer page = Integer.parseInt(p);
			String stuName = request.getParameter("stuName");
			List<FollowStudentPo> list = stuPoDao.getAllocatedStudentList(emp.getId(), "正常", "已分配", stuName);
			List<FollowStudentPo> followStuList = stuPoDao.getListThenDividPage(request, list, page);
			request.setAttribute("page", page);
			request.setAttribute("queryString", noPageQueryString(request) );
			request.setAttribute("followStuList",followStuList);
			getServletPathAndForward(request,"counselor/cou_manage.jsp");

	}
}
